package com.heima.search.config;

import com.heima.search.interceptor.AppTokenInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//想让AppTokenInterceptor生效：
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 添加在interceptor里定义的拦截器
        registry.addInterceptor(new AppTokenInterceptor())
                .addPathPatterns("/**");//需要拦截什么请求(所有请求)
    }
}
